Telegram Group & Telegram Channel
Note #33: Разбор доклада Marwan Sulaiman - Handling Go Errors GopherCon 2019

Марван рассказывает и показывает как они обрабатывают ошибки в New York Times. Основная идея доклада в том, что у вас есть доменная модель и работать с ошибками необходимо по аналогии как Вы работаете с вашей доменной моделью. Делается это лучше всего, в виде type Error struct в пакете errors:
package Errors

// based on https://upspin.googlesource.com/upspin/+/master/errors/errors.go#23
type Error struct {
// a unique string describing a method or a function e.g. getUser
Op op

// can be predefined code/or own code (http/gRPC)
Kind kind

// you can add severity
Severity logrus.Level

// You can add any application Specific Data e.g.
ZipCode string
CreatedAt time.Time
}

Вариант использование:
if err != nil {
return &errors.Error{Op: “getUser”, Error: err}
}

По сути это доклад - это пересечение двух статей [2] и [3] с примерам и подробным описанием что означает каждое поле в структуре Error. Также Марван показывает несколько утилит которые помогают работать с такими ошибками (большая часть из проекта Upspin).

Данный подход помогает не только быстро понять, что и где сломалось в контексте приложения, но и легко настроить фильтры в системе логирования и мониторинга.
Если тема Вам близка то я рекомендую посмотреть видео [1] и/или прочитать еще раз эти статьи [2][3]:

Links:
[1] https://www.youtube.com/watch?v=4WIhhzTTd0Y
[2] https://middlemost.com/failure-is-your-domain/
[3] https://commandcenter.blogspot.com/2017/12/error-handling-in-upspin.html
[4] https://upspin.googlesource.com/upspin/+/master/errors/errors.go#23



tg-me.com/golang_for_two/58
Create:
Last Update:

Note #33: Разбор доклада Marwan Sulaiman - Handling Go Errors GopherCon 2019

Марван рассказывает и показывает как они обрабатывают ошибки в New York Times. Основная идея доклада в том, что у вас есть доменная модель и работать с ошибками необходимо по аналогии как Вы работаете с вашей доменной моделью. Делается это лучше всего, в виде type Error struct в пакете errors:

package Errors

// based on https://upspin.googlesource.com/upspin/+/master/errors/errors.go#23
type Error struct {
// a unique string describing a method or a function e.g. getUser
Op op

// can be predefined code/or own code (http/gRPC)
Kind kind

// you can add severity
Severity logrus.Level

// You can add any application Specific Data e.g.
ZipCode string
CreatedAt time.Time
}

Вариант использование:
if err != nil {
return &errors.Error{Op: “getUser”, Error: err}
}

По сути это доклад - это пересечение двух статей [2] и [3] с примерам и подробным описанием что означает каждое поле в структуре Error. Также Марван показывает несколько утилит которые помогают работать с такими ошибками (большая часть из проекта Upspin).

Данный подход помогает не только быстро понять, что и где сломалось в контексте приложения, но и легко настроить фильтры в системе логирования и мониторинга.
Если тема Вам близка то я рекомендую посмотреть видео [1] и/или прочитать еще раз эти статьи [2][3]:

Links:
[1] https://www.youtube.com/watch?v=4WIhhzTTd0Y
[2] https://middlemost.com/failure-is-your-domain/
[3] https://commandcenter.blogspot.com/2017/12/error-handling-in-upspin.html
[4] https://upspin.googlesource.com/upspin/+/master/errors/errors.go#23

BY 🇺🇦 Go for two :)


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/golang_for_two/58

View MORE
Open in Telegram


🇺🇦 Go на двоих Telegram | DID YOU KNOW?

Date: |

Telegram is riding high, adding tens of million of users this year. Now the bill is coming due.Telegram is one of the few significant social-media challengers to Facebook Inc., FB -1.90% on a trajectory toward one billion users active each month by the end of 2022, up from roughly 550 million today.

What Is Bitcoin?

Bitcoin is a decentralized digital currency that you can buy, sell and exchange directly, without an intermediary like a bank. Bitcoin’s creator, Satoshi Nakamoto, originally described the need for “an electronic payment system based on cryptographic proof instead of trust.” Each and every Bitcoin transaction that’s ever been made exists on a public ledger accessible to everyone, making transactions hard to reverse and difficult to fake. That’s by design: Core to their decentralized nature, Bitcoins aren’t backed by the government or any issuing institution, and there’s nothing to guarantee their value besides the proof baked in the heart of the system. “The reason why it’s worth money is simply because we, as people, decided it has value—same as gold,” says Anton Mozgovoy, co-founder & CEO of digital financial service company Holyheld.

🇺🇦 Go на двоих from us


Telegram 🇺🇦 Go for two :)
FROM USA